<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<script type="text/javascript" src="../../zxt/zxt.js"></script>
		<script>importZXT("../../zxt");</script>
	</head>
	
	<body>
		
		<div id="card" zxt="zxt.ui.Cardidbox" zxt.required="false" zxt.tip="cardID" style="width:200px;height:20px;"></div>
		
		<hr>
				
		<input type="button" onclick="javascript:setWrong();" value="WRONG ID"/>
		<input type="button" onclick="javascript:setCorrect();" value="CORRECT ID"/>
		<input type="button" onclick="javascript:setEmpty();" value="EMPTY ID"/>
		<input type="button" onclick="javascript:validate();" value="VALIDATE ID"/>
		
		<div id="card2" zxt="zxt.ui.Cardidbox" zxt.required="false" zxt.tip="cardID" style="width:200px;height:20px;"></div>
		<div id="card3" zxt="zxt.ui.Cardidbox" zxt.required="false" zxt.tip="cardID" style="width:200px;height:20px;"></div>
		<table>
			<tr>
				<td>getType()</td>
				<td> 返回控件类型</td>
				<td><input type="button" name="getType" value="getType" 
					onclick="alert('卡号控件的type为'+$zxtUI.card3.getType());"/></td>
			</tr>
			<tr>
				<td>getMask()</td>
				<td>[MASK]模式下显示卡号值</td>
				<td><input type="button" name="getMask" value="getMask" 
					onclick="alert('卡号控件的getMask为'+$zxtUI.card2.getMask());"/></td>
			</tr>
			<tr>
				<td>getSelfLabel()</td>
				<td>返回格式处理后的卡号</td>
				<td><input type="button" name="getSelfLabel" value="getSelfLabel" 
					onclick="alert('卡号控件的getSelfLabel为'+$zxtUI.card3.getSelfLabel());"/></td>
			</tr>
			<tr>
				<td>getSelfValue()</td>
				<td>返回卡号输入框中输入的字符串</td>
				<td><input type="button" name="getSelfValue" value="getSelfValue" 
					onclick="alert('卡号控件的getSelfValue为'+$zxtUI.card3.getSelfValue());"/></td>
			</tr>
		</table>
		
		<div id="cardidbox1"></div>
		
		<div><a href="../index.html">返回</a></div>
	</body>
</html>

<script type="text/javascript">
	$zxt.init();
	
	$zxtUI.card2.mode("NORMAL");
	$zxtUI.card2.renderValue("1111111111111111");
	$zxtUI.card3.renderValue("1111111111111111");
	
	function setWrong(){		
		$zxtUI.card.renderValue("abb");
	}
	
	function setCorrect(){		
		$zxtUI.card.renderValue("5298670340000651");
	}
	
	function setEmpty(){		
		$zxtUI.card.renderValue("");
	}
	
	function validate(){
		alert($zxt.validate(["card"])[0]["STATUS"].type);
	}
	
	//cardidbox构造函数(是否必填，提示)
	var box = new zxt.ui.Cardidbox("true","cardID");
	$zxt.register(box);
	$("#cardidbox1").append(box.render());
</script>
